{% extends 'CHOMPSGIBundle:Incidente:base.html.twig' %}

{% block actions %}			
<div class="well sidebar-nav"><div class="panel-group" id="accordion">  
    FILTROS

    {{ form_start(form) }}
    <div class="panel panel-default">
        <div class="panel-heading"><h4 class="panel-title"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse1" style="width: 100%;"> 
            <button class="btn dropdown-toggle" data-toggle="collapse" style="width: 100%;">
                {{ form.id.vars.label }}
                <span class="caret pull-right"></span>
            </button></a></h4>
        </div>
        <div id="collapse1" class="panel-collapse collapse in"><div class="panel-body">
            {{ form_errors(form.id) }}
            {{ form_widget(form.id) }}
            </div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><h4 class="panel-title"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse2" style="width: 100%;"> 
            <button class="btn dropdown-toggle" data-toggle="collapse" style="width: 100%;">
                {{ form.titulo.vars.label }}
                <span class="caret pull-right"></span>
            </button></a></h4>
        </div>
        <div id="collapse2" class="panel-collapse collapse"><div class="panel-body">
            {{ form_errors(form.titulo) }}
            {{ form_widget(form.titulo) }}
            </div>
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading"><h4 class="panel-title"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse3" style="width: 100%;"> 
            <button class="btn dropdown-toggle" data-toggle="collapse" style="width: 100%;">
                {{ form.empresa.vars.label }}
                <span class="caret pull-right"></span>
            </button></a></h4>
        </div>
        <div id="collapse3" class="panel-collapse collapse"><div class="panel-body">
            {{ form_errors(form.empresa) }}
            {{ form_widget(form.empresa) }}
            </div>
        </div>
    </div>
    
    <div class="panel panel-default">
        <div class="panel-heading"><h4 class="panel-title"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse4" style="width: 100%;"> 
            <button class="btn dropdown-toggle" data-toggle="collapse" style="width: 100%;">
                {{ form.creador.vars.label }}
                <span class="caret pull-right"></span>
            </button></a></h4>
        </div>
        <div id="collapse4" class="panel-collapse collapse"><div class="panel-body">
            {{ form_errors(form.creador) }}
            {{ form_widget(form.creador) }}
            </div>
        </div>
    </div>
    
    <div class="panel panel-default">
        <div class="panel-heading"><h4 class="panel-title"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse5" style="width: 100%;"> 
            <button class="btn dropdown-toggle" data-toggle="collapse" style="width: 100%;">
                {{ form.responsableSoporte.vars.label }}
                <span class="caret pull-right"></span>
            </button></a></h4>
        </div>
        <div id="collapse5" class="panel-collapse collapse"><div class="panel-body">
            {{ form_errors(form.responsableSoporte) }}
            {{ form_widget(form.responsableSoporte) }}
            </div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><h4 class="panel-title"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse6" style="width: 100%;"> 
            <button class="btn dropdown-toggle" data-toggle="collapse" style="width: 100%;">
                {{ form.estado.vars.label }}
                <span class="caret pull-right"></span>
            </button></a></h4>
        </div>
        <div id="collapse6" class="panel-collapse collapse"><div class="panel-body">
            {{ form_errors(form.estado) }}
            {{ form_widget(form.estado) }}
            </div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><h4 class="panel-title"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse7" style="width: 100%;"> 
            <button class="btn dropdown-toggle" data-toggle="collapse" style="width: 100%;">
                {{ form.grupoSoporte.vars.label }}
                <span class="caret pull-right"></span>
            </button></a></h4>
        </div>
        <div id="collapse7" class="panel-collapse collapse"><div class="panel-body">
            {{ form_errors(form.grupoSoporte) }}
            {{ form_widget(form.grupoSoporte) }}
            </div>
        </div>
    </div>
    
        <div style="margin-top:20px; border-top: 1px solid #ddd; padding: 10px 0">
            {{ form_widget(form.filtrar, { 'attr': {'class': 'btn pull-right'} }) }}
        </div>
    </div>
    {{ form_end(form) }}
</div>
{% endblock %}

{% block content %}
    <div style="padding: 20px 0;">
            <a class="btn btn-success" href="{{ path("incidente_nuevo") }}">Crear Incidente</a>
    </div>

    <table class="table table-striped table-bordered table-condensed listado">

        <tr>
            <th>ID</th>
            <th>Titulo</th>
            <th>Empresa</th>
            <th>Creado por</th>
            <th>Resp Soporte</th>
            <th>Estado</th>
            <th>Grupo Soporte</th>
        </tr>
        {% for incidente in incidentes %}
            <tr>
                <td><a href="{{path('incidente_ver',{ 'id': incidente.id })}}">{{ incidente.id }}</a></td>
                <td>{{incidente.titulo}}</td>
                <td>{{incidente.getEmpresa.getNombre | default("") }}</td>
                <td>{{incidente.getCreador.getNombre | default("") }}</td>
                <td>{{incidente.getResponsableSoporte.getNombre | default("") }}</td>
                <td>{{incidente.getEstado.getNombre  | default("") }}</td>
                <td>{{incidente.getGrupoSoporte.getNombre | default("") }}</td>
                
                <td><a href="{{path('incidente_editar',{ 'id': incidente.id })}}">Editar</a></td>
                    <!--	
    <div class="btn-group">
                    <button class="btn btn-mini btn-success">Ver</button>
                    <button class="btn btn-mini btn-warning">Cambiar</button>
                    <button class="btn btn-mini btn-danger disabled">Borrar</button>
                    </div>
            -->
            </tr>

        {% endfor %}
        <tr>
            <td colspan="9"> 
                    {{ pagerfanta (incidentes, 'twitter_bootstrap_translated' , { 'prev_message' : 'Anterior', 'next_message': 'Siguiente'} ) }}  <!-- ,  -->
            </td> 
        </tr>
    </table>

{% endblock %}
